import Vue from 'vue'

// 重置默认样式 reset.css
import 'normalize.css/normalize.css'

import ElementUI from 'element-ui'
// index.css 设置element-ui组件的样式
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css
import request from '@/utils/request'
import * as directives from '@/directives'
import * as filters from '@/filters'
import componets from '@/components/index'
import i18n from '@/lang'
// import 两个作用
// 1.导入某个模块
// 2.直接执行导入的js文件
import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import Print from 'vue-print-nb'
Vue.use(Print)

// Vue.use(ElementUI)
// 配置ElementUI的中英切换逻辑
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
Vue.use(componets)

Vue.config.productionTip = false
Vue.prototype.$request = request

// 2.通过Object.keys来批量注册
Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
// 固定语法 process.env
// console.log(process.env)

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
